Global list doesn't contain value at another function [migrated]

Posted by burakim on Super User See other posts from Super User or by burakim
Published on 2012-10-26T21:55:39Z Indexed on 2012/10/26 23:05 UTC
Read the original article Hit count: 125

Filed under:
|

I want to make a global list and I saved a value in my global list (def rand()).

Whatever I save, my saved value doesnt include at another function except rand().

What am I missing?

sayi = []

def rand():

    global sayi
    initial = 1000
    for i in range(1000,10000):
        initial +=1
        sayi.append(initial)
    print sayi[43]


def main():

    rand()
    print len(sayi) /////// Shows 0 but I have added value at rand funct. with append funct.
    main()

© Super User or respective owner

Related posts about python

Related posts about python3.2